home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / EBKSRC.ARJ / PCLED.HPP < prev    next >
C/C++ Source or Header  |  1991-07-30  |  1KB  |  69 lines

  1. /*
  2.  
  3.     pcled.hpp
  4.     7-30-91
  5.     Line Edit for the IBM PC Text Modes.
  6.  
  7.     Copyright 1991
  8.     John W. Small
  9.     All rights reserved
  10.     Use freely but acknowledge authorship and copyright.
  11.  
  12.  
  13.     PSW / Power SoftWare
  14.     P.O. Box 10072
  15.     McLean, Virginia 22102 8072 USA
  16.  
  17.     Voice: (703) 759-3838
  18.     CIS: 73757,2233
  19.  
  20. */
  21.  
  22. #ifndef PCLED_HPP
  23. #define PCLED_HPP
  24.  
  25. #ifndef PCWIN_HPP
  26. #include <pcwin.hpp>
  27. #endif
  28.  
  29.  
  30. typedef int (*TFvaliD)(char * response, int maxlen);
  31. #define TFvaliD0 ((TFvaliD)0)
  32.  
  33. class LineEdit {
  34.     PalettE P;
  35. public:
  36.     static Palette defaultP;
  37.     enum LE_PALETTE { COLOR, PROMPT, RESPONSE,
  38.         PREFERENCE };
  39.     void setPalette(PalettE P = PalettE0)
  40.         { this->P = (P? P : defaultP); }
  41.     LineEdit(PalettE P = PalettE0)
  42.         { setPalette(P); }
  43.     int edit(char *response, int sizeofResponse,
  44.         int flen, int x = 0, int y = 0,
  45.         const char *pref = (char *)0,
  46.         const char *prompt = (char *)0,
  47.         TFvaliD validate = TFvaliD0);
  48. };
  49.  
  50. class LineEditWindow : TextWindow, LineEdit  {
  51. public:
  52.     LineEditWindow() : TextWindow(), LineEdit() {}
  53.     void setPalette(PalettE TWP = PalettE0,
  54.         PalettE LEP = PalettE0)
  55.     {
  56.         TextWindow::setPalette(TWP);
  57.         LineEdit::setPalette(LEP);
  58.     }
  59.     int edit(char *response, int sizeofResponse,
  60.         int flen, int x = 0, int y = 0,
  61.         const char *pref = (char *)0,
  62.         const char *prompt = (char *)0,
  63.         TFvaliD validate = TFvaliD0);
  64. };
  65.  
  66.  
  67. #endif
  68.  
  69.